package com.javasm.gg.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.javasm.gg.Goods;
import com.javasm.gg.Supplier;
import com.javasm.gg.SupplierService;
import com.javasm.gg.dao.SupplierDao;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class SupplierServiceimpl extends ServiceImpl<SupplierDao,Supplier> implements SupplierService {
    @Override
    public List<Goods> listGoodsBySuplierid(Integer id) {
        return this.baseMapper.listGoodsBySupplierId(id);
    }

    @Transactional
    @Override
    public boolean setGoods2Supplier(String sid, String[] gids) {
        this.baseMapper.removeGoodsBySupplierId(sid);
        int i = this.baseMapper.addGoods2Supplier(gids, sid);
        return i>=1;
    }

}
